home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14055 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  64 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!boyse
  3. From: boyse@netcom.com (William Boyse)
  4. Subject: g++ 2.5.8 -> 2.7.0 Syntax Error
  5. Message-ID: <boyseDozKHC.JyA@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. Date: Thu, 28 Mar 1996 16:29:35 GMT
  9. Sender: boyse@netcom23.netcom.com
  10.  
  11. I up(down?)graded my Linux OS and got g++ 2.7.0.  I had been using 
  12. 2.5.8.  My finite element code would not compile due to various changes 
  13. in the compiler.  I fixed them all bug one.  For the life of me I can't 
  14. see what's wrong.  Please help!  The following is the rendered code and 
  15. compiler output.
  16.  
  17. // Definition of Lagrangian finite element classes
  18.  
  19. #include <stdlib.h>
  20.  
  21. enum Elt_Type {None, Tri_3, Tri_6, Quad_4, Tet_4};
  22.  
  23. // Base class for elements
  24. class Element
  25. {
  26. public:
  27.  
  28.     int elt_number; // element number
  29.     Elt_Type elt_type; // element type
  30.     int n_nodes; // number of nodes
  31.     int prop_id; // property ID
  32.     int surf_id; // surface property ID
  33.     int *nodes; // [n_nodes]
  34.     float **node_coord; // [n_nodes] [3]
  35.  
  36.     Element(void)
  37.     : elt_number(0), elt_type(None), n_nodes(0),
  38.       nodes(NULL), node_coord(NULL) {}; // Default constructor
  39. };
  40.  
  41. // 6 node triangular element
  42. class Tri_6 : public Element
  43. {
  44. public:
  45.     Tri_6(void) : Element() {}; // Default Constructor
  46. };
  47.  
  48. //  Element Utility Routines
  49. Element *Next_Element(Element *ptr_elt)
  50. {
  51.     ptr_elt = new Tri_6(); //  ******* THIS IS THE OFFENDING LINE ********
  52.     return ptr_elt;
  53. }
  54. cd ~/fem++/src/bug/
  55. make -k elt_class.o
  56. g++    -c elt_class.cc -o elt_class.o
  57. elt_class.cc: In function `class Element * Next_Element(class Element *)':
  58. elt_class.cc:35: parse error before `('
  59. make: *** [elt_class.o] Error 1
  60.  
  61. Compilation exited abnormally with code 2 at Thu Mar 28 08:13:19
  62.  
  63.  
  64.